package com.example.mybatis;

import com.example.mybatis.entity.Person;
import com.example.mybatis.service.PersonService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@MapperScan("com.example.mybatis.dao")

public class MybatisApplication {

	public static void main(String[] args) {
		ApplicationContext ac = SpringApplication.run(MybatisApplication.class, args);
		PersonService p = ac.getBean("personService",PersonService.class);
		Person vo = new Person();
		vo.setId(1L);

		vo = p.select(vo).get(0);
		System.out.println(vo);

	}
}
